package com.zyh.thread.demo2;

/**
 * @Author zyh
 * @Date 2024/8/8 11:03
 * @Description synchronized 的可重入性
 */

public class ThreadDemo2 {
    public static void main(String[] args) {
        MyTask myTask = new MyTask();
        new Thread(myTask).start();
    }
}
class MyTask implements Runnable{
    @Override
    public synchronized void run() {
        System.out.println("run中的同步方法");
        meth1();

    }
    public synchronized void meth1(){
        System.out.println("meth1中的同步方法");
    }
}
